<template>
  <echart :options="chartOptions" :height="300" />
</template>

<script>
import { Echart } from '@/components/Echart';
export default {
  name: 'LineChart',
  components: { Echart },
  props: {
    options: {
      type: [String, Object],
      default: () => {}
    }
  },
  data() {
    return {
      chartOptions: {}
    };
  },
  watch: {
    options: {
      handler(val) {
        try {
          if (typeof val == 'string') {
            this.chartOptions = JSON.parse(val);
          } else {
            this.chartOptions = val;
          }
        } catch (e) {
          console.error('lineChart Error!', e);
        }
      },
      deep: true,
      immediate: true
    }
  },
  methods: {
    initChart() {}
  }
};
</script>

<style></style>
